package com.hqyj.bigdata.hiveproject.controller;

import com.hqyj.bigdata.hiveproject.entity.TopTenCatalogVideoInfo;
import com.hqyj.bigdata.hiveproject.json.R;
import com.hqyj.bigdata.hiveproject.service.TopTenCatalogVideoInfoService;
import com.hqyj.bigdata.hiveproject.view.TopTenCatalogVideoInfoView;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;

import javax.annotation.Resource;

@RestController
@RequestMapping("catalog-video")
public class TopTenCatalogVideoInfoController {

    @Resource
    private TopTenCatalogVideoInfoService topTenCatalogVideoInfoService;


    @GetMapping("topTen")
    public R queryTopTenCatalogVideoInfo(){
        try{
            //List<TopTenCatalogVideoInfo> topTenCatalogVideoInfoList = topTenCatalogVideoInfoService.queryTopTenCatalogVideoInfoList();
            TopTenCatalogVideoInfoView topTenCatalogVideoInfoView = topTenCatalogVideoInfoService.queryTopTenCatalogVideoInfoView();
            return R.success("查询板块视频播放量前十名列表成功！",topTenCatalogVideoInfoView);
        }catch (Exception ex){
            ex.printStackTrace();
            return R.error("程序出现异常！");
        }
    }
}
